<@t.html>
<@t.container title="邮箱设置" icon="cogs" >
				<@t.form>
					<#if bean??>
        				<input type="hidden" id="id" name="id" value="${bean.id}"/>	
					</#if>
					<@t.text title="SMTP服务器地址" help="一般smtp服务器地址：smtp.qq.com;smtp.163.com等" id="smtp_host" value="${bean.smtp_host!''}" />    
					<@t.text title="SMTP用户名" id="smtp_user" value="${bean.smtp_user!''}" />    
                	<@t.text title="SMTP密码" id="smtp_pass" value="${bean.smtp_pass!''}" />
                	<@t.text title="发件人名称" id="smtp_name" value="${bean.smtp_name!''}" />
                	<@t.text title="发件人Email" id="smtp_email" value="${bean.smtp_email!''}" />
					<@t.submitBtn/>
               </@t.form>
</@t.container>
<script type="text/javascript">
     $(function(){
		//提交表单
       	  $('#add_form').validator({
        		theme: 'yellow_right_effect',  //设置theme
        		stopOnError: true, //
        		showOk:false,
        	    fields: {
        	        "smtp_host": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写SMTP服务器地址",
        	            msg: {
        	            	required: "SMTP服务器地址不可以为空!",
        	            }
        	        },
        	        "smtp_user": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写SMTP用户名",
        	            msg: {
        	            	required: "SMTP用户名不可以为空!",
        	            }
        	        },
        	        "smtp_pass": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写密码",
        	            msg: {
        	            	required: "密码不可以为空!",
        	            }
        	        },
        	        "smtp_name": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写发件人名称",
        	            msg: {
        	            	required: "发件人名称不可以为空!",
        	            }
        	        },
        	        "smtp_email": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写发送email",
        	            msg: {
        	            	required: "发送email不可以为空!",
        	            }
        	        }
        	    }
        	});
		  $('#add_form').on('valid.form', function(e, form){
		  	   //成功之后刷新gd，关闭自己
			   var data=$(this).serialize();
               $ .axsf('admin/mail/add',data,function(d){
			   		if(d){
                         if(d.code==200){
							window.location.reload();
                         }else{
						 	alert(d.message);
						 }
                	}
			   });
        });
	});
    </script>
</@t.html>